/**
	@file mainwindow.h
	Copyright (C) 2011  AlexK. <alexander.kaspar@gmail.com>
**/

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QtGui>
#include <QString>
#include <QDialog>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QTextStream>
#include <QProgressBar>
#include <QDomDocument>
#include <QProcess>

#include "_myfile.h"
#include "transfer.h"
#include "ui_mainwindow.h"
#include "ui_settingsdlg.h"

/**
 * @class MainWindow
 * @brief Main Class in this project.
 **/
class MainWindow : public QDialog, public Ui::MainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = 0);
    MainWindow(QString fileName, QWidget *parent = 0);

	void processDirectory(const QString &dirName);	// process all IFX Files in dirName
    int processFile(const QString &fileName);			// read IFX File
    bool writeFile(const QString &fileName);		// write OFX File
    void log(const QString &color, const QString &message);		// Log message to logTextBrowser
    QString toOfxTime( QString &tmptime );	// format to YYYY-MM-DD
    QDomDocument writeOfxBase();

    _MyFile IFXFile, OFXFile;
    QString ifxfile, ifxdir, ofxfile, ofxdir;		// public variables
    QFile ifxdoc;
    QDomDocument ofxdoc;
    transfer ifx, ofx;

public slots:
    void saveSettings(QString, QString, QString);

private:
    void loadSettings(QString id);
    void loadSettings();
    QString _ifxf, _ifxd, _ofxf, _ofxd;
	QString SettingsFile;
	QString gncPath;
    QString effdt, accttype, acctid, acctcur;
    QStringList strings;

private slots:
    void on_ifxLineEdit_textChanged();	// ifxLineEdit changed
    void on_ifxOpenButton_clicked();	// show OpenFile or OpenDir Dialog
	void on_ofxOpenButton_clicked();
	void on_allCheckBox_clicked();
    int process();				// process IFX File
	void reject();				// overloaded reject slot
    void saveSettings();
    void settings();

signals:
};

#endif
